/**
 *  CSV Parser
 *  Luciano RUBIO <luciano@loociano.com>
 *
 * This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <stdio.h>
#include <stdlib.h>

#include <iostream>
#include <sstream>
#include <string>

#include "Common.h"

using namespace std;

const char kGram = 'g';
const char kMilli = 'm';
const size_t kMinimumData = 20;

class Item
{
public:

	/** Constructor */
	Item();

	/** Destructor */
	~Item();

	double parseString(string);
	string removeUnits(string);
	double stringToDouble(string);
	void printData();

	// Getters and setters
	const string& getBrand() const;
	void setBrand(const string& brand);
	double getCalories() const;
	void setCalories(double calories);
	double getCaloriesIn() const;
	void setCaloriesIn(double caloriesIn);
	double getCarbs() const;
	void setCarbs(double carbs);
	double getCarbsIn() const;
	void setCarbsIn(double carbsIn);
	double getCholesterol() const;
	void setCholesterol(double cholesterol);
	double getCholesterolIn() const;
	void setCholesterolIn(double cholesterolIn);
	double getFats() const;
	void setFats(double fats);
	double getFatsIn() const;
	void setFatsIn(double fatsIn);
	double getFiber() const;
	void setFiber(double fiber);
	double getFiberIn() const;
	void setFiberIn(double fiberIn);
	const string& getMeal() const;
	void setMeal(const string& meal);
	const string& getName() const;
	void setName(const string& name);
	double getProtein() const;
	void setProtein(double protein);
	double getProteinIn() const;
	void setProteinIn(double proteinIn);
	double getServings() const;
	void setServings(double servings);
	double getSodium() const;
	void setSodium(double sodium);
	double getSodiumIn() const;
	void setSodiumIn(double sodiumIn);
	double getSugars() const;
	void setSugars(double sugars);
	double getSugarsIn() const;
	void setSugarsIn(double sugarsIn);

private:

	string meal;
	string brand;
	string name;
	double servings;

	// Nutritional info for one serving
	double calories; // Cal
	double sugars; // grams
	double carbs; // grams
	double fats; // grams
	double protein; // grams
	double cholesterol; // milligrams
	double sodium; // milligrams
	double fiber; // grams

	// Intakes computed from number of servings
	double calories_in; // Cal
	double sugars_in; // grams
	double carbs_in; // grams
	double fats_in; // grams
	double protein_in; // grams
	double cholesterol_in; // milligrams
	double sodium_in; // milligrams
	double fiber_in; // grams
};
